package com.konne.nightmare.FastPublicOpinion.ui.information.adapter;

import android.view.View;

import androidx.annotation.Nullable;

import com.blankj.utilcode.util.LogUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.coorchice.library.SuperTextView;
import com.konne.nightmare.FastPublicOpinion.R;
import com.konne.nightmare.FastPublicOpinion.bean.StudentTeamBean;
import com.konne.nightmare.FastPublicOpinion.ui.information.activity.GroupManagerActivity;

import java.util.List;

/**
 * Create by ws.
 * on Data:2022/1/24  Time:下午 6:31.
 * description: ** .
 */
public class StudentTeamAdapter extends BaseQuickAdapter<StudentTeamBean, BaseViewHolder> {
    public StudentTeamAdapter(@Nullable List<StudentTeamBean> data) {
        super(R.layout.item_student_team,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, StudentTeamBean item) {
        SuperTextView stv_tag=helper.getView(R.id.stv_tag);
        stv_tag.setTextColor(getTagColor(item.getType()));
        stv_tag.setStrokeColor(getTagColor(item.getType()));
        stv_tag.setText(getTagTxt(item.getType()));
        helper.setText(R.id.tv_title,item.getTitle())
                .setText(R.id.tv_into_num,String.valueOf(item.getIntoUserNum()))
                .setText(R.id.tv_group_num,String.valueOf(item.getGroupNum()))
                .setText(R.id.tv_uninto_num,String.valueOf(item.getUnIntoUserNum()));
                helper.getView(R.id.ll_content).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        GroupManagerActivity.start(2);
                    }
                });

    }
    private int getTagColor(int type){
        switch (type){
            case 0:
                return 0xffFF943E;
            case 1:
                return 0xffFD5640;
            default:
                return 0xff0098FE ;
        }
    }
    private String getTagTxt(int type){
        switch (type){
            case 0:
                return "随机";
            case 1:
                return "指定";
            default:
                return "自由" ;
        }
    }
}
